package ru.michaeltyan.familyconnector.dao.impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import ru.michaeltyan.familyconnector.beans.FoodstuffList;
import ru.michaeltyan.familyconnector.dao.FoodstuffListDao;

public class FoodstuffListDaoImpl extends HibernateDaoSupport implements FoodstuffListDao {

	public void save(FoodstuffList FoodstuffList) {
		getHibernateTemplate().save(FoodstuffList);
	}

	public void update(FoodstuffList FoodstuffList) {
		getHibernateTemplate().update(FoodstuffList);

	}

	public void delete(FoodstuffList FoodstuffList) {
		getHibernateTemplate().delete(FoodstuffList);

	}

	public FoodstuffList findById(long id) {
		@SuppressWarnings("rawtypes")
		List FoodstuffLists = getHibernateTemplate().find("from FoodstuffList where id=?", id);
		if (FoodstuffLists != null && FoodstuffLists.size() > 0) {
			return (FoodstuffList) FoodstuffLists.get(0);
		} else {
			return null;
		}
	}

}
